#include <cstdio>

#define OUTPUT_START "PERFECTION OUTPUT"
#define OUTPUT_FORMAT "%5d  "
#define OUTPUT_END "END OF OUTPUT"

#define PERFECT "PERFECT"
#define DEFICIENT "DEFICIENT"
#define ABUNDANT "ABUNDANT"

#define LIMIT 60001


/******************************************/


template <typename N>
inline N gcd (N a, N b)
{
	N r;
	while (r = a % b)
	{
		a = b;
		b = r;
	}
	return b;
}


/******************************************/


int sum[LIMIT] = {0};


inline int sum_divisors (const int n)
{
	int &sn = sum[n], n2 = n / 2;

	if (n == 1 && sn != -1)
		return sn;

	sn = 1;
	for (int d = 2; d <= n2; ++d)
	{
		if (n % d)
			continue;
		sn += d;
	}

	return sn;
}


/******************************************/


int main ()
{
	int n, sd;

	puts(OUTPUT_START);

	while (scanf("%d", &n), n)
	{
		printf(OUTPUT_FORMAT, n);
		sd = sum_divisors(n);
		if (n < sd)
			puts(ABUNDANT);
		else if (n > sd)
			puts(DEFICIENT);
		else
			puts(PERFECT);
	}

	puts(OUTPUT_END);

	return 0;
}